home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / vsa256.zip / VSA256.TXT < prev    next >
Text File  |  1996-03-20  |  84KB  |  2,090 lines

  1. *******************************************************************************
  2. Blueberry Graphics(TM)             7910 W. Brookridge Dr., Middletown, MD 21769
  3.                              http://ourworld.compuserve.com/homepages/blueberry
  4. *******************************************************************************
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.                              VSA256 Graphics Library
  16.                                 For C Programmers
  17.  
  18.                                    Version 4.0
  19.                                   March 17, 1996
  20.  
  21.  
  22.                        Copyright Spyro Gumas, 1992 - 1996.
  23.                                All Rights Reserved
  24.  
  25.  
  26.  
  27.  
  28.  
  29.                        Look what You get for Registering!!
  30.  
  31.           -    Royalty Free Use of VSA256 in Your Programs!
  32.           -    Graphics Mouse Library!
  33.           -    Joystick Library & Source Code!
  34.           -    Image Processing Library & Source Code!
  35.           -    32 Bit WATCOM C Compiler compatible library!
  36.           -    3D Graphics Library!
  37.           -    On line support through CompuServe!
  38.           -    Printed Users Manual and Software Disk!
  39.           -    Half Price upgrade to next version!
  40.  
  41.                             (See Page 7 for Details)
  42.                         
  43.                         
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.                                  Page: 1
  55.                                
  56. 1.0 Introduction                                         4
  57.      1.1 Revision History                                5
  58.      1.2 Benefits of Registering                         7
  59.      1.3 Distribution Files                              8
  60. 2.0 The Programming Environment                          9
  61.      2.1 Setting Up The VESA Environment                 9
  62.      2.2 Global Graphics Parameters                      9
  63.      2.3 Compiler Compatibility                          10
  64. 3.0 Function Descriptions                                12
  65.      3.1 VESA Configuration Functions                    12
  66.           3.1.1 vsa_set_svga_mode                        12
  67.           3.1.2 vsa_get_svga_mode                        13
  68.           3.1.3 vsa_init                                 13
  69.      3.2 Miscellaneous Functions                         14
  70.           3.2.1 vsa_set_display_start                    14
  71.           3.2.2 vsa_get_display_start                    14
  72.           3.2.3 vsa_set_draw_page                        14
  73.           3.2.4 vsa_get_draw_page                        15
  74.           3.2.5 vsa_set_view_page                        15
  75.           3.2.6 vsa_get_view_page                        15
  76.           3.2.7 vsa_wait_vsync                           16
  77.      3.3 Attribute Functions                             16
  78.           3.3.1 vsa_set_color                            16
  79.           3.3.2 vsa_get_color                            16
  80.           3.3.3 vsa_set_text_color                       17
  81.           3.3.4 vsa_get_text_color                       17
  82.           3.3.5 vsa_set_clip_mode                        17
  83.           3.3.6 vsa_get_clip_mode                        17
  84.           3.3.7 vsa_set_triangle_clip_mode               17
  85.           3.3.8 vsa_get_triangle_clip_mode               18
  86.           3.3.9 vsa_set_viewport                         18
  87.           3.3.10 vsa_get_viewport                        18
  88.      3.4 Color Look Up Table Functions                   19
  89.           3.4.1 vsa_read_color_register                  19
  90.           3.4.2 vsa_write_color_register                 19
  91.           3.4.3 vsa_read_color_block                     19
  92.           3.4.4 vsa_write_color_block                    20
  93.      3.5 Text Functions (Vector Stroked!)                20
  94.           3.5.1 vsa_set_text_cursor                      21
  95.           3.5.2 vsa_get_text_cursor                      21
  96.           3.5.3 vsa_set_text_scale                       21
  97.           3.5.4 vsa_get_text_scale                       22
  98.           3.5.5 vsa_set_text_cursor_mode                 22
  99.           3.5.6 vsa_get_text_cursor_mode                 22
  100.           3.5.7 vsa_write_string                         22
  101.           3.5.8 vsa_write_string_alt                     23
  102.      3.6 Basic Drawing Functions                         23
  103.           3.6.1 vsa_move_to                              23
  104.           3.6.2 vsa_set_pixel                            23
  105.           3.6.3 vsa_get_pixel                            24
  106.           3.6.4 vsa_line_to                              24
  107.           3.6.5 vsa_gouraud_line                         24
  108.           3.6.6 vsa_rect                                 25
  109.                                  Page: 2
  110.                                
  111.           3.6.7 vsa_rect_fill                            25
  112.           3.6.8 vsa_triangle                             25
  113.           3.6.9 vsa_triangle_fill                        25
  114.           3.6.10 vsa_shaded_triangle                     26
  115.           3.6.11 vsa_h_line                              26
  116.           3.6.12 vsa_v_line                              26
  117.      3.7 Specialized Drawing Functions                   27
  118.           3.7.1 vsa_raster_line                          27
  119.           3.7.2 vsa_get_raster_line                      27
  120.           3.7.3 vsa_image_size                           27
  121.           3.7.4 vsa_get_image                            28
  122.           3.7.5 vsa_put_image                            28
  123. 4.0 Nitty Gritties                                       29
  124.      4.1 Registration Information                        29
  125.      4.2 Software License                                30
  126.      4.3 Disclaimer                                      31
  127.      4.4 Technical Support                               31
  128. 5.0 Application Notes                                    32
  129.      5.1 Using Triangles                                 32
  130.      5.2 Page Flipping                                   32
  131.      5.3 Using Off Screen Video Memory                   32
  132.      5.4 Expanding the VSA_FONT Character Set            33
  133. 6.0 Graphics Library Extensions                          33
  134. 6.1 The VSA256 GLE Developers Program                    33
  135. 6.2 Existing Graphics Library Extensions                 35
  136. 7.0 Appendix                                             36
  137.      7.1 VSA.H Include File                              36
  138.      7.2 VSA_FONT.H Include File                         38
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.                                  Page: 3
  165.                                
  166.  
  167. 1.0 INTRODUCTION
  168.  
  169.   The VSA256 Graphics Library provides a C programmer with the tools necessary
  170. to generate graphics output on a video adapter running with the Video
  171. Electronics Standards Association (VESA) version 1.2 BIOS extensions.
  172. The VESA BIOS extensions standardize the Super VGA (SVGA) graphics environment.
  173. The name "VSA256" reflects the fact that this library is aimed at supporting
  174. the 256 color video modes 100h, 101h, 103h, 105h, and 107h defined within the
  175. VESA standard (See table in section 3.1.1).
  176.  
  177.  
  178.  
  179.                         
  180.                         
  181.                         
  182.                         
  183.                         
  184.                         
  185.                         
  186.                         
  187.                         
  188.                         
  189.                         
  190.                         
  191.                         
  192.                         
  193.                         
  194.                         
  195.                         
  196.                         
  197.                         
  198.                         
  199.                         
  200.                         
  201.                         
  202.                         
  203.                         
  204.                         
  205.                         
  206.                         
  207.                         
  208.                         
  209.                         
  210.                         
  211.                         
  212.                         
  213.                         
  214.                         
  215.                         
  216.                         
  217.                         
  218.  
  219.                                  Page: 4
  220.                                
  221. 1.1 Revision History
  222. Version 1.0 is the original SHAREWARE version of the VSA256 Graphics Library.
  223.  
  224. Version 1.1 is the SHAREWARE version of the VSA256 Graphics Library which
  225. corrected some compiler compatibility problems and added the
  226. vsa_get_raster_line function which was necessary for the TIFF256 Graphics
  227. Library Extensions.  Some drawing errors were also corrected.
  228.  
  229. Version 2.0b is the REGISTERED version of the VSA256 Graphics Library.  Whereas
  230. the VSA256 Graphics Library Version 1.x is shareware, Version 2.0b IS NOT
  231. shareware and may only be used in accordance with the terms of the purchase
  232. agreement.
  233.  
  234. Version 3.2 is presented to the general public in the true spirit of shareware.
  235. I  no longer maintain a separate registered version of this library.  Version
  236. 3.2 of the VSA256 Graphics Library is presented as ShareWare with high hopes
  237. that the programmers who use this library will feel good about sending in the
  238. registration.
  239.  
  240. - Added Viewport Clipping          - Now works with Small, Medium,
  241. - Added BitBLT functions.            Compact Large memory models with
  242. - Added Vector Text: Infinitely      Borland (Already did so with
  243.   scaleable and set to nearest       Microsoft)
  244.   pixel, fonts are fully user      - Fixed "unresolved external
  245.   definable!                         _fstrlen" linker error (Turbo C)
  246. - Added Global Parameter           - Now text routines work with ALL
  247.   VSA_ATI_COLOR for some ATI         video adapters
  248.   cards.  (defaults to 0, set      - Made all functions in VSA.H See
  249.   it to 1 if ATI card locks up.      external, no more "Multiple
  250.   README.TXT)                        Declaration" warnings
  251.  
  252. Version 4.0 provides significantly increased drawing speeds over version 3.2
  253. (see the VSA256 Revision Comparison Table).  In addition, real functionality
  254. improvements are introduced into the library as a result of user feedback.
  255.  
  256. - MAJOR SPEED-UP of all drawing    - Added page flipping support for
  257.   functions!                         double buffered drawing
  258. - Changed vsa_set_viewport so      - Made the user definable FONT array
  259.   that 'BOTTOM' can be set           expandable, to support foreign
  260.   beyond bottom of displayable       languages
  261.   video memory.  Now the user      - Added vsa_get... functions for all
  262.   can use off screen memory to       existing vsa_set... functions
  263.   store bitmaps for BitBLTs        - Made VSA_ATI_COLOR autodetect ATI
  264.                                      cards
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.                                  Page: 5
  275.                                
  276.  
  277.                         VSA256 Revision Comparison Table
  278.  
  279.  
  280. Drawing Functions*       V1 V2 V3 V4      Control Functions         V1 V2 V3 V4
  281. ------------------------------------      -------------------------------------
  282. vsa_move_to               *  *  *  *      vsa_set_svga_mode          *  *  *  *
  283. vsa_set_pixel             *  *  *  *      vsa_get_svga_mode          *  *  *  *
  284. vsa_get_pixel                   *  *      vsa_init                   *  *  *  *
  285. vsa_line_to               * 3x 3x 6x      vsa_set_display_start      *  *  *  *
  286. vsa_gouraud_line             *  * 2x      vsa_get_display_start      *  *  *  *
  287. vsa_rect                  * 3x 3x 6x      vsa_set_draw_page                   *
  288. vsa_rect_fill             *  *  * 4x      vsa_get_draw_page                   *
  289. vsa_triangle                       *      vsa_set_view_page                   *
  290. vsa_triangle_fill            *  * 2x      vsa_get_view_page                   *
  291. vsa_shaded_triangle          *  * 2x      vsa_wait_vsync                   *  *
  292. vsa_h_line                * 3x 3x 4x      vsa_set_color              *  *  *  *
  293. vsa_v_line                *  *  * 2x      vsa_get_color                       *
  294. vsa_raster_line           * 2x 2x 3x      vsa_set_text_color         *  *  *  *
  295. vsa_get_raster_line          *  * 3x      vsa_get_text_color                  *
  296. vsa_image_size                  *  *      vsa_set_clip_mode                *  *
  297. vsa_get_image                   * 3x      vsa_get_clip_mode                   *
  298. vsa_put_image                   * 3x      vsa_set_triangle_clip_mode          *
  299.                                           vsa_get_triangle_clip_mode          *
  300.                                           vsa_set_viewport                 *  *
  301.                                           vsa_get_viewport                    *
  302.  
  303. Text Functions           V1 V2 V3 V4
  304. -------------------------------------
  305. vsa_set_text_cursor       *  *  *  *
  306. vsa_get_text_cursor             *  *
  307. vsa_set_text_scale              *  *      Color Functions           V1 V2 V3 V4
  308. vsa_get_text_scale                 *      -------------------------------------
  309. vsa_set_text_cursor_mode  *  *  *  *      vsa_read_color_register    *  *  *  *
  310. vsa_get_text_cursor_mode           *      vsa_write_color_register   *  *  *  *
  311. vsa_write_string          *  *  *  *      vsa_read_color_block       *  *  *  *
  312. vsa_write_string_alt      *  *  *  *      vsa_write_color_block      *  *  *  *
  313.  
  314.  
  315.           * For Drawing Functions, speed-up factors shown are relative to
  316.             speed of VSA256 Version 1.0
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.                                  Page: 6
  330.                                
  331.  
  332. 1.2 Benefits of Registering
  333.   If you use this program beyond an initial evaluation period, you must
  334. register your use with a $34 remittance to the author .. me.  In addition to
  335. the good feeling that you get for sustaining a late night hacking obsession,
  336. you get the following benefits for registering:
  337.  
  338. 1)   Royalty Free Use of VSA256 in Your Programs! Feel free to distribute your
  339.      programs for profit with no royalty fees.  See section 4.2.
  340.  
  341. 2)   Graphics Mouse Library!   Use this library to integrate Mouse input with
  342.      your graphics applications.  Get precise updates of mouse position,
  343.      update screen cursor, read mouse buttons, and more.  Invent your own
  344.      graphical user interface, give your apps that professional feel, have
  345.      tons of fun!
  346.  
  347. 3)   Joystick Library with Source Code!   Integrate Joystick input with your
  348.      graphics applications.  Write a flight simulator, boat driver, or your
  349.      own unique use of this agile input device.
  350.  
  351. 4)  IMP256 Image Processing Library and Source Code!  With this library you can
  352.      learn all about image sharpening, embossing, blurring, color
  353.      balancing, and enhancement.
  354.  
  355. 5)   32 Bit WATCOM C Compiler compatible VSA256 and TIFF256 libraries!  Get the
  356.      edge on performance.
  357.  
  358. 6)   3D Graphics Library!   Don't live in a flat world.  Add the missing 3rd
  359.      dimension to your creations.  This library lets you create 3d objects,
  360.      set your view point, and perform 3d transformations including scale,
  361.      offset, and rotation.  Supports wireframe, solid, and Gouraud shaded
  362.      objects.  (Still being developed).
  363.  
  364. 7)   On line support through CompuServe.
  365.  
  366. 8)   Printed Users Manual and Current Version Software on Disk.
  367.  
  368. 9)   One Half Price Upgrade to the next version, as it becomes available.
  369.  
  370.                                        AND
  371.          As if that's not enough, for a measly $15 more,  you will get:
  372.  
  373. 10)  TIFF256 Graphics Library Extensions.  This extension to the VSA256 library
  374.      lets you read TIFF formatted graphic image files, display them, modify
  375.      them, and write them back to disk.  Furthermore, anything that you
  376.      create and display on the screen can be saved as a TIFF image file.
  377.                         
  378.                         
  379.                         
  380.                         
  381.                         
  382.                         
  383.  
  384.                                  Page: 7
  385.                                
  386.  
  387.                                        AND
  388.  
  389. 11) The following public domain full color TIFF image files to get you started:
  390.                                    VENUS.TIF
  391.                                    EARTH.TIF
  392.                                    MOON.TIF
  393.                                    MARS.TIF
  394.                                    SATURN.TIF
  395.                                    NEPTUNE.TIF
  396.                                    SHUTTLE.TIF
  397.                                    ASTRONTS.TIF
  398.                                    WEATHER.TIF
  399.                                    MANDRILL.TIF
  400.  
  401.                            (What, no Ginsu Knife Set?)
  402.  
  403. 1.3 Distribution Files
  404. The distribution of the VSA256 Graphics Library Version 4.0 consists of the 12
  405. files listed below plus the drivers listed in Section 2.1.  These files are
  406. archived in the file VSA256.ZIP.  To extract, just type 'PKUNZIP VSA256' in the
  407. directory that you want the files extracted to.
  408.  
  409. VSA256MS.LIB                VSA256 Graphics Library (Microsoft C compatible).
  410. VSA256BC.LIB                VSA256 Graphics Library(Borland C Compatible).
  411. VSA.H                       VSA256 Include file required in your program.
  412. VSA_FONT.H                  VSA256 Include file required in your program.
  413. VSA_DEMO.C                  VSA256 Demonstration program (Source Code).
  414. VSA_DEMO.EXE                VSA256 Demonstration program (Executable).
  415. VSA_DEMO.MAK                VSA_DEMO Make file for Microsoft C.
  416. VSA_DEMO.PRJ                VSA_DEMO Project file for Borland C/C++ V3.1.
  417. VSA_DEMO.IDE                VSA_DEMO Project file for Borland C/C++ V4.0.
  418. VSA256.TXT                  This text document.
  419. ORDER.TXT                   Text file order form for registration and upgrades.
  420. README.TXT                  Text file with important info.
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.                                  Page: 8
  440.                                
  441.  
  442. 2.0 THE PROGRAMMING ENVIRONMENT
  443.  
  444. 2.1 Setting Up The VESA Environment
  445.   The VSA256 Graphics Library works with any (any?) IBM PC, XT, AT or
  446. compatible computer equipped with a VESA compatible SVGA video adapter card
  447. capable of 256 colors.  Most  of the video cards sold today are VESA compatible
  448. with the VESA BIOS built in to the card.  A math coprocessor chip is not
  449. required.
  450.   For older SVGA video cards which are not VESA compatible, the VESA BIOS
  451. Extensions must be loaded as a Terminate and Stay Resident (TSR) program before
  452. using the VSA256 Graphics Library.  This is accomplished by executing the
  453. appropriate driver or adding it to your AUTOEXEC.BAT file.  If your video
  454. adapter card came with a VESA driver, use it.  Otherwise use one of the drivers
  455. provided depending on the video adapter card installed in the PC as follows:
  456.  
  457. APPIAN                 \APPIAN\APVESA.EXE
  458. ATI                    \ATI\VESA.COM
  459. C&T                    \C&T\VESA451.COM (or VESA452.COM)
  460. CIRRUS                 \CIRRUS\CRUSVESA.COM
  461. EVEREX                 \EVEREX\EVRXVESA.COM
  462. GENOA                  \GENOA\VESA.COM
  463. OAK                    \OAK\37VESA.COM (or67VESA.COM)
  464. ORCHID                 \ORCHID\ORCHDVSA.COM
  465. PARADISE               \PARADISE\VESA.EXE
  466. SIGMA                  \SIGMA\SIGVESA.COM
  467. STB                    \STB\STB-VESA.COM
  468. TECMAR                 \TECMAR\VGAVESA.COM
  469. TRIDENT                \TRIDENT\VESA.EXE
  470. VIDEO7                 \VIDEO7\V7VESA.COM
  471.  
  472. 2.2 Global Graphics Parameters
  473.   The VSA.H and VSA_FONT.H  files are used as include files during program
  474. development.  These files includes all of the function prototypes and define
  475. the global graphics parameters that describe the specific video adapter
  476. installed in the PC (see Section 7).  The global graphics parameters are
  477. initialized by the vsa_init function and are described below:
  478.  
  479. XResolution:      Unsigned, number of screen pixels across (x dimension).
  480. YResolution:      Unsigned, number of screen pixels high (y dimension).
  481. XCharResolution:  Unsigned, number of screen characters across (x dimension).
  482. YCharResolution:  Unsigned, number of screen characters high (y dimension).
  483. XCharSize:        Unsigned char, the character drawn cell width.
  484. YCharSize:        Unsigned char, the character drawn cell height.
  485. BitsPerPixel:     Unsigned char, the number of bits per pixel.
  486. XLeft:            Int, the left edge of the screen clipping Viewport.
  487.                         
  488.                         
  489.                         
  490.                         
  491.                         
  492.                          
  493.  
  494.                                  Page: 9
  495.                                
  496. YTop:             Int, the top edge of the screen clipping Viewport.
  497. XRight:           Int, the right edge of the screen clipping Viewport.
  498. YBottom:          Int, the bottom edge of the screen clipping Viewport.
  499. Text_X_Scale:     Float, multiplies XCharBase to get text width in pixels.
  500. Text_Y_Scale:     Float, multiplies YCharBase to get text height in pixels.
  501. XCharBase:        Unsigned, the fundamental text character width.
  502. YCharBase:        Unsigned, the fundamental text character height.
  503. ASC[96][72]:      Unsigned Char, the 2D array of character vertices.
  504. VSA_ATI_COLOR     Int, set it to 1 if your ATI board locks up.  Defaults to 0.
  505.  
  506.   Note that there is a fundamental difference between how you use VSA.H and how
  507. you use VSA_FONT.H.  The function prototypes and the global parameter
  508. declarations are all "extern" in VSA.H.  This means that you can plop VSA.H
  509. into
  510. the top of each and every code module (file) which is part of your project.
  511. VSA_FONT.H, on the other hand, declares and initializes the 'ASC[][]' array.
  512. Since I want you, the programmer, to have access to the font definitions, I
  513. couldn't make these parameter declarations "extern".  What this means for you
  514. is that if you have multiple code modules (files), only include VSA_FONT.H in
  515. one of the files.  Then put the following two lines of code at the top of each
  516. and every other code module (file) in your project:
  517.  
  518.              extern unsigned far XCharBase, far YCharBase;
  519.              extern unsigned char far ASC[][72];
  520.  
  521. 2.3 Compiler Compatibility
  522.   The VSA256MS.LIB was compiled using Microsoft's Quick C 2.5 and it seems to
  523. also work well with Microsoft C 6.0 and 7.0.  I have received reports of
  524. compatibility problems with Microsoft C 5.0.
  525.   The VSA256BC.LIB was compiled using Borland's C/C++ 3.1 and it seems to also
  526. work well with Borland C/C++ 3.0 and 4.0.  I have received conflicting reports
  527. of compatibility problems with Borland's Turbo C 2.0 and 3.0.
  528.   I appreciate any feedback that programmers send me along these lines so that
  529. I can continue to improve this product.
  530.  
  531.                         Important Note for Borland Users:
  532.  
  533.   You MUST set the -Fs compiler option.  This tells the compiler to assume that
  534. the Stack Segment equals the Data Segment.  In the Programmers IDE, you go to
  535. Options / Compiler / Code Generation and select "Always" under the option
  536. "Assume SS Equals DS".
  537.   Why?  The VSA256 library can be used in Tiny, Small, Medium, Compact, and
  538. Large memory models in both the Microsoft and Borland environments.  Microsoft
  539. always puts the Stack Segment in the first Data Segment, but Borland sets up a
  540. separate Stack Segment (for Compact and Large memory models) unless you specify
  541. the -Fs option.  Failing to set -Fs will result in a "Stack Overflow!" error
  542. when running code compiled in Compact or Large memory models.
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.                                  Page: 10
  550.                                
  551.  
  552.                        Important Note for C++ Developers:
  553.  
  554.   I compiled and linked the VSA256 Graphics Library as a C library (not C++).
  555. I know that Borland will give you grief if you try to link in my C library with
  556. your C++ program.  You need to do one of two things:
  557.  
  558. 1)   Write your program as a C program (.C extension, not .CPP)
  559.  
  560.                                    or
  561.  
  562. 2)   Contact me and I can send you a C++ compiled version of the library.
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.                                  Page: 11
  605.                                
  606.  
  607. 3.0 FUNCTION DESCRIPTIONS
  608.  
  609. This section describes the functions supported in the VSA256 Graphics Library.
  610. To use these functions, link your program with the appropriate library listed
  611. below depending on the compiler being used.
  612.  
  613.               Borland C, C++ or Turbo C   -    VSA256BC.LIB
  614.               Microsoft C or Quick C      -    VSA256MS.LIB
  615.  
  616.   In the following sections each function is listed along with a definition of
  617. its inputs and return values.  A description is provided followed by the
  618. version in which the function became available.  Finally, if applicable,
  619. comments are provided.
  620.  
  621. 3.1 VESA Configuration Functions
  622. 3.1.1 vsa_set_svga_mode
  623. Prototype:     unsigned vsa_set_svga_mode(unsigned video_mode);
  624.  
  625. Description:   This routine sets the video mode.  The mode number may be any
  626.          of the standard VESA SVGA mode numbers as defined in the tables below.
  627.          The mode is passed to this routine through the 'video_mode' parameter.
  628.          This routine returns a 'fail_flag' = 0 if the call was a success (a 1
  629.          for failure). It should be noted that this routine will also work with
  630.          standard MDA, CGA, EGA, and VGA mode numbers, however the rest of the
  631.          VSA256 functions will not necessarily work.
  632.  
  633. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  634.  
  635. WARNING: Use vsa_init Instead (Section 3.1.3)!  If you don't use vsa_init, then
  636. the rest of the routines won't work because they depend on the global
  637. parameters initialized by vsa_init;
  638.  
  639.                               VESA SVGA VIDEO MODES
  640.  
  641. GRAPHICS         Mode         Resolution     Colors
  642.                  100h          640x400        256
  643.                  101h          640x480        256
  644.                  102h          800x600         16
  645.                  103h          800x600        256
  646.                  104h          1024x768        16
  647.                  105h          1024x768       256
  648.                  106h          1280x1024       16
  649.                  107h          1280x1024      256
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.                                  Page: 12
  660.                                
  661.  
  662. TEXT             Mode          Columns        Rows
  663.                  108h             80           60
  664.                  109h            132           25
  665.                  10Ah            132           43
  666.                  10Bh            132           50
  667.                  10Ch            132           60
  668.  
  669. 3.1.2 vsa_get_svga_mode
  670. Prototype:     unsigned vsa_get_svga_mode(unsigned far *video_mode);
  671.  
  672. Description:   This routine gets the current video mode.  The mode is returned
  673.           to the calling routine via the 'video_mode' pointer.  The mode number
  674.           may be any of the standard VESA SVGA mode numbers as defined in
  675.           Section 3.1.1. This routine returns a 'fail_flag' = 0 if the call was
  676.           a success (a 1 for failure).
  677.  
  678. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  679.  
  680. Comments:      Works in all VESA video modes.  Also works in MDA, CGA, EGA and
  681.                VGA Modes.
  682.  
  683. 3.1.3 vsa_init
  684. Prototype:     unsigned vsa_init(unsigned video_mode);
  685.  
  686. Description: This routine sets the video mode and initializes the VESA graphics
  687.           environment.  This routine must be called prior to the use of any of
  688.           the routines in Sections 3.2 through 3.7.  The mode number may be any
  689.           of the standard VESA SVGA mode numbers as defined in Section 3.1.1.
  690.           If the mode number is not a VESA SVGA mode number, this routine will
  691.           still set the desired video mode, however, the VESA graphics
  692.           environment will not be initialized and subsequent calls to drawing
  693.           routines will produce unpredictable results.  The mode is passed to
  694.           this routine through the 'video_mode' parameter. This routine returns
  695.           a 'fail_flag' = 0 if the call was a success.  For failures, the
  696.           'fail_flag' has the following meaning:
  697.  
  698.           1  -  Can not get Super VGA Environment information.  Make sure
  699.                 VESA BIOS TSR is loaded.
  700.           2  -  VESA BIOS TSR not loaded.  Need to load one.
  701.           3  -  Specified Video Mode not supported by this video card.  Try
  702.                 another mode.
  703.           4  -  Specified Video Mode was set but it is not one of the VESA
  704.                 standard modes.  VSA256 may not function properly.
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.                                  Page: 13
  715.                                
  716.  
  717.           5  -  Can not get Super VGA Video Mode Data.  Make sure correct
  718.                 VESA BIOS TSR is loaded.
  719.  
  720. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  721.  
  722. Comments:      Starting with Version 3.0, VSA256 no longer prints out error
  723.           messages automatically to the screen.  The programmer gets full
  724.           status feed back via the 'fail_flag' and can do as he/she sees fit.
  725.           Also note that VSA256 no longer cares if the specific VESA BIOS
  726.           Extensions TSR being used supports text functions.  This is due to
  727.           the new implementation of text using vector strokes (see
  728.           vsa_write_string).
  729.  
  730. 3.2 Miscellaneous Functions
  731. 3.2.1 vsa_set_display_start
  732. Prototype:    unsigned vsa_set_display_start(unsigned x_strt, unsigned y_strt);
  733.  
  734. Description:   This routine sets the current start pixel address which is
  735.           mapped to the upper left corner of the display.  This routine returns
  736.           a 'fail_flag' = 0 if the call was a success (a 1 for failure).
  737.  
  738. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  739.  
  740. Comments:      Don't bother with this unless you are hard core.  Use
  741.                vsa_set_draw_page and vsa_set_view_page instead!
  742.  
  743. 3.2.2 vsa_get_display_start
  744. Prototype:     unsigned vsa_get_display_start(unsigned far *x_strt,
  745.                                              unsigned far *y_strt);
  746.  
  747. Description:  This routine gets the current start pixel address which is mapped
  748.           to the upper left corner of the display.  This routine returns a
  749.           'fail_flag' = 0 if the call was a success (a 1 for failure).
  750.  
  751. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  752.  
  753. Comments:      See vsa_get_draw_page and vsa_get_view_page also!
  754.  
  755. 3.2.3 vsa_set_draw_page
  756. Prototype:     void vsa_set_draw_page(int page);
  757.  
  758. Description:   This routine sets the current DRAW_PAGE in video memory to
  759.           'page'.  All drawing actions occur into the current DRAW_PAGE of
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.                                  Page: 14
  770.                                
  771.           memory.  This routine is useful when you want to display from one
  772.           portion of video memory (see vsa_set_view_page) while drawing into
  773.           another.
  774.               To determine the total available number of pages in video
  775.           memory, divide the total available video RAM size by the display
  776.           area.  For example a 1MB SVGA card running in 640 x 480 mode has 3.4
  777.           pages (you can reasonably use pages 0, 1, and 2 for a total of 3
  778.           pages).  Setting 'page' to a value beyond the number of existing
  779.           pages will cause unpredictable stuff.   After vsa_init, the
  780.           DRAW_PAGE defaults to 0.
  781.  
  782. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  783.  
  784. Comments:      Page flipping (Ping Pong Buffering or Double Buffering) is
  785.                a really cool thing to do because it makes your redraws look
  786.                instantaneous (see Sec. 5.2).
  787.  
  788. 3.2.4 vsa_get_draw_page
  789. Prototype:     int vsa_get_draw_page(void);
  790.  
  791. Description:   This routine returns the current DRAW_PAGE.
  792.  
  793. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  794.  
  795. 3.2.5 vsa_set_view_page(int page);
  796. Prototype:    void vsa_set_view_page(int page);
  797.  
  798. Description:   This routine sets the current VIEW_PAGE in video memory to
  799.           'page'.  The current screen display comes from the VIEW_PAGE of
  800.           memory.  This routine is useful when you want to display from one
  801.           portion of video memory while drawing into another (see
  802.           vsa_set_draw_page). To determine the total available number of pages
  803.           in video memory, divide the total available video RAM size by the
  804.           display area.  For example a 1MB SVGA card running in 640 x 480 mode
  805.           has 3.4 pages (you can reasonably use pages 0, 1, and 2 for a total
  806.           of 3 pages).  Setting 'page' to a value beyond the number of existing
  807.           pages will cause unpredictable stuff.   After vsa_init, the VIEW_PAGE
  808.           defaults to 0.
  809.  
  810. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  811.  
  812. Comments:      Page flipping (Ping Pong Buffering or Double Buffering) is
  813.                a really cool thing to do because it makes your redraws look
  814.                instantaneous (see Sec. 5.2).
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.                                  Page: 15
  825.                         
  826.  
  827. 3.2.6 vsa_get_view_page
  828. Prototype:     int vsa_get_view_page(void);
  829.  
  830. Description:   This routine returns the current VIEW_PAGE.
  831.  
  832. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  833.  
  834. 3.2.7 vsa_wait_vsync
  835. Prototype:     void vsa_wait_vsync(void );
  836.  
  837. Description:   This routine waits until the beginning of the CRTs' vertical
  838.           retrace period before returning control to the calling program.  If
  839.           vsa_wait_vsync is called while the CRT is in vertical retrace, this
  840.           routine waits until the completion of the current retrace period and
  841.           the completion of the following active scan and then returns at the
  842.           beginning of the next vertical retrace period.  The programmer can
  843.           use this function to precede drawing functions which must be executed
  844.           during CRT Vertical Retrace.  The programmer is assured the full
  845.           retrace time for his use.
  846.  
  847. Availability:  In VSA256 Graphics Library Version 3.0 and up.
  848.  
  849. Comments:      Try using vsa_wait_vsync just prior to each vsa_set_view_page
  850.                call to get rid of flicker effects (see Sec. 5.2).
  851.  
  852. 3.3 Attribute Functions
  853. 3.3.1 vsa_set_color
  854. Prototype:     void vsa_set_color(unsigned color);
  855.  
  856. Description:   This routine sets the current drawing color which is used in
  857.           drawing pixels, lines, rectangles, and triangles.  The "color" is an
  858.           8 bit value from 0 to 255 which is used to index in to the Color Look
  859.           Up Table (see Section 3.4).
  860.  
  861. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  862.  
  863.  
  864. 3.3.2 vsa_get_color
  865. Prototype:     unsigned vsa_get_color(void);
  866.  
  867. Description:   This routine returns the current drawing color.
  868.  
  869. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.                                  Page: 16
  880.                                
  881.  
  882. 3.3.3 vsa_set_text_color
  883. Prototype:     void vsa_set_text_color(unsigned color);
  884.  
  885. Description:   This routine sets the current text color which is used in
  886.           drawing text.  The "color" is an 8 bit value from 0 to 255 which is
  887.           used to index in to the Color Look Up Table (see Section 3.4).  Since
  888.           the text is drawn using vector strokes, the background is unaffected
  889.           by newly drawn text.  Note: this also means that drawing a text
  890.           'space' character does nothing but index the text pointer.
  891.  
  892. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  893.  
  894. 3.3.4 vsa_get_text_color
  895. Prototype:     unsigned vsa_get_text_color(void);
  896.  
  897. Description:   This routine returns the current text color.
  898.  
  899. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  900.  
  901. 3.3.5 vsa_set_clip_mode
  902. Prototype:     void vsa_set_clip_mode(unsigned mode);
  903.  
  904. Description:   This routine sets the Viewport clipping mode ON if 'mode' = 1,
  905.           OFF otherwise.  After vsa_init, the default is ON.
  906.  
  907. Availability:  In VSA256 Graphics Library Version 3.0 and up.
  908.  
  909. 3.3.6 vsa_get_clip_mode
  910. Prototype:     unsigned vsa_get_clip_mode(void);
  911.  
  912. Description:   This routine returns the Viewport clipping mode.
  913.  
  914. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  915.  
  916. 3.3.7 vsa_set_triangle_clip_mode
  917. Prototype:     void vsa_set_triangle_clip_mode(unsigned mode);
  918.  
  919. Description:   This routine sets the Triangle clipping mode ON if 'mode' = 1,
  920.           OFF otherwise. After vsa_init, the default is ON.  This function only
  921.           affects clipping for triangles drawn with vsa_triangle,
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.                                  Page: 17
  935.                                
  936.           vsa_triangle_fill, and vsa_shaded_triangle.  For triangle clipping to
  937.           be on, both Viewport clipping mode AND Triangle clipping mode must be
  938.           on.
  939.  
  940. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  941.  
  942. Comments:      See Section 5.1 for a short discussion about this.
  943.  
  944. 3.3.8 vsa_get_triangle_clip_mode
  945. Prototype:     unsigned vsa_get_triangle_clip_mode(void);
  946.  
  947. Description:   This routine returns the Triangle clipping mode.
  948.  
  949. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  950.  
  951. 3.3.9 vsa_set_viewport
  952. Prototype:     void vsa_set_viewport(int left,int top,int right,int bottom);
  953.  
  954. Description:   This routine sets the global Viewport clipping parameters XLeft,
  955.          YTop, XRight, and YBottom. Note that vsa_init initializes these values
  956.           to the full screen dimensions for the selected video mode.  Viewport
  957.           clipping is turned on and off through the vsa_set_clip_mode function.
  958.           By default, clip mode is ON after vsa_init.
  959.              When clip mode is ON, all items drawn on the screen through VSA256
  960.           functions are clipped to the screen Viewport rectangle defined by
  961.           XLeft, YTop, XRight, and YBottom.
  962.             NOTE:  Triangles will only be clipped if BOTH Viewport clipping AND
  963.           Triangle clipping are on (see vsa_set_triangle_clip_mode).
  964.  
  965. Availability:  In VSA256 Graphics Library Version 3.0 and up.
  966.  
  967. Comments:      If you have enough video RAM, you can set 'BOTTOM' past the
  968.           bottom of the screen.  Then you can draw things down there (like
  969.           buttons) and BitBLT them up to the displayed area as needed (see
  970.           Sec. 5.3).
  971.  
  972. 3.3.10 vsa_get_viewport
  973. Prototype:     void vsa_get_viewport(int far *pleft,int far *ptop,
  974.                                     int far *pright,int far *pbottom);
  975.  
  976. Description:   This routine returns the global Viewport clipping parameters
  977.           XLeft, YTop, XRight, and YBottom via the pointers '*pleft', '*ptop',
  978.           '*pright', and '*pbottom' respectively.
  979.  
  980. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.                                  Page: 18
  990.                                
  991.  
  992. 3.4 Color Look Up Table Functions
  993.   The Color Look Up Table consists of 256 registers and each register stores an
  994. 18 bit value defining 6 bit levels for each of red, green, and blue.  The
  995. drawing functions index into the Color Look Up Table with an 8 bit value
  996. (usually set with vsa_set_color) to determine the drawing color. With the
  997. following functions, the Color Look Up Table can be read or modified one
  998. register at a time or all at once in a block operation.
  999.  
  1000. 3.4.1 vsa_read_color_register
  1001.  
  1002. Prototype:     void vsa_read_color_register(unsigned index,unsigned char far
  1003.                   *redptr,unsigned char far *grnptr,unsigned char far *bluptr);
  1004.  
  1005. Description:   This routine reads the value of one of the 256 color registers
  1006.          as defined by 'index'. Pointers to the red, green, and blue components
  1007.           of the color are returned (6 bits each for red, green, and blue).
  1008.  
  1009. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1010.  
  1011. 3.4.2 vsa_write_color_register
  1012.  
  1013. Prototype:     void vsa_write_color_register(unsigned index,unsigned char red,
  1014.                                      unsigned char green,unsigned char blue);
  1015.  
  1016. Description:   This routine writes the value of one of the 256 color registers
  1017.           as defined by 'index'.  The calling routine provides 'red', 'green',
  1018.           and 'blue' components of the color (6 bits each for red, green, and
  1019.           blue).
  1020.  
  1021. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1022.  
  1023. 3.4.3 vsa_read_color_block
  1024. Prototype:     void vsa_read_color_block(unsigned start,unsigned count,
  1025.                                          unsigned char far *array);
  1026.  
  1027. Description:   This routine reads 'count' (Range: 1 to 256) consecutive color
  1028.           registers starting at 'start' (Range: 0 to 255) within the Color Look
  1029.           Up Table.  The 'count' must be less than or equal to 256 - 'start'.
  1030.           The values read from the color registers are returned from this
  1031.           routine in 'array[]'.  Each element of 'array[]' is a byte, and the
  1032.           size of 'array[]' is equal to three times 'count'.  Every three bytes
  1033.           in 'array[]' represents the red, green, and blue color values
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.                                  Page: 19
  1045.                                
  1046.          respectively for one color register. Each color component (red, green,
  1047.           or blue) is a byte value but only ranges from 0 to 63.
  1048.  
  1049. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1050.  
  1051. 3.4.4 vsa_write_color_block
  1052. Prototype:     void vsa_write_color_block(unsigned start,unsigned count,
  1053.                                          unsigned char far *array);
  1054.  
  1055. Description:   This routine writes 'count' (Range: 1 to 256) consecutive color
  1056.           registers starting at 'start' (Range: 0 to 255) within the Color Look
  1057.           Up Table.  The 'count' must be less than or equal to 256 - 'start'.
  1058.           The values loaded into the color registers are passed to this routine
  1059.           in 'array[]'.  Each element of 'array[]' is a byte, and the size of
  1060.           'array[]' is equal to three times 'count'.  Every three bytes in
  1061.           'array[]' represents the red, green, and blue color values
  1062.          respectively for one color register. Each color component (red, green,
  1063.           or blue) is a byte value but only ranges from 0 to 63.
  1064.  
  1065. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1066.  
  1067. 3.5 Text Functions (Vector Stroked!)
  1068.   Starting with VSA256 Version 3.0, text support has been completely REVAMPED!
  1069. The library no longer relies on the video card manufacturers BIOS to get text
  1070. support.  Instead each character is drawn using 2D vector strokes.  The
  1071. advantages are as follows:
  1072.  
  1073.      - Text now works with ALL video cards!
  1074.      - Now text is Infinitely scaleable.
  1075.      - Text positioning resolution is down to 1 pixel.
  1076.      - Background color is preserved.
  1077.      - The programmer can define his own fonts in VSA_FONT.H (see Sec.
  1078.        5.4)
  1079.  
  1080. Some minor incompatibilities with VSA256 version 2.0 were introduced due to
  1081. the changes and they are as follows:
  1082.  
  1083.      - vsa_write_string now takes x,y (in pixel coordinates) instead
  1084.        of row,col (in character coordinates) as the first two
  1085.        parameters.
  1086.      - The vsa_write_char function was deleted.
  1087.      - The supported ASCII characters are the printable characters
  1088.        from ASCII code 32 to ASCII code 127.
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.                                  Page: 20
  1100.                                
  1101.  
  1102. Your existing code should take very little editing to make these changes,
  1103. especially if you write a macro to edit all occurrences of vsa_write_string as
  1104. follows:
  1105.  
  1106.   OLD - vsa_write_string(row,col,color,text);
  1107.  
  1108.   NEW - vsa_write_string(col*XCharSize,row*YCharSize,color,text);
  1109.  
  1110. 3.5.1 vsa_set_text_cursor
  1111. Prototype:     void vsa_set_text_cursor(int x,int y);
  1112.  
  1113. Description:   This routine sets the current text cursor position to 'x,y' in
  1114.           pixel coordinates.  The current text cursor position is only used
  1115.           by vsa_write_string_alt.
  1116.  
  1117. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1118.  
  1119. Comments:      Note that with Rev 3.0 this function changed to pixel
  1120.                coordinates to support vector stroked fonts.
  1121.  
  1122. 3.5.2 vsa_get_text_cursor
  1123. Prototype:     void vsa_get_text_cursor(int far *px,int far *py);
  1124.  
  1125. Description:   This routine gets the current text cursor position and returns
  1126.           the x and y positions via the pointers '*px' and '*py' respectively.
  1127.           The returned positions are in pixel coordinates.  The current text
  1128.           cursor position is only used by vsa_write_string_alt.
  1129.  
  1130. Availability:  In VSA256 Graphics Library Version 3.0 and up.
  1131.  
  1132. 3.5.3 vsa_set_text_scale
  1133. Prototype:     void vsa_set_text_scale(float x_scale,float y_scale);
  1134.  
  1135. Description:   This routine sets the x and y scale factors for text drawn with
  1136.           the vsa_write_string and vsa_write_string_alt routines. The 'x_scale'
  1137.           and 'y_scale' scale factors are applied to the global parameters
  1138.           XCharBase and YCharBase respectively to determine the drawn text
  1139.           character width and height in pixels.  Since these scale factors are
  1140.           floating point, continuously and infinitely scaleable text characters
  1141.           are possible.
  1142.             This routine automatically adjusts the global parameters XCharSize,
  1143.           YCharSize, XCharResolution and YCharResolution to their appropriate
  1144.           values.  After vsa_init, the x_scale and y_scale factors both default
  1145.           to 1.0.
  1146.  
  1147. Availability:  In VSA256 Graphics Library Version 3.0 and up.
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.                                  Page: 21
  1155.                                
  1156. 3.5.4 vsa_get_text_scale
  1157. Prototype:    void vsa_get_text_scale(float far *px_scale,float far *py_scale);
  1158.  
  1159. Description:   This routine returns the x and y scale factors used for text via
  1160.           the pointers '*px' and '*py' respectively.
  1161.  
  1162. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  1163.  
  1164. 3.5.5 vsa_set_text_cursor_mode
  1165. Prototype:     void vsa_set_text_cursor_mode(unsigned mode);
  1166.  
  1167. Description:   This routine determines the mode of the text cursor operation.
  1168.          If 'mode' is '0' (the default after calling vsa_init), the text cursor
  1169.           is not updated after a new text string is written with
  1170.           vsa_write_string or vsa_write_string_alt. If 'mode' is '1', then the
  1171.           text cursor is moved to the end of the text string after executing
  1172.           vsa_write_string or vsa_write_string_alt.
  1173.  
  1174. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1175.  
  1176. Comments:      If the text cursor mode is set to '1', the programmer may
  1177.           override the cursor operation as follows.  If a '\r' is placed at the
  1178.           end of the text string, the text cursor X value will reset to the
  1179.           beginning of the text string (equivalent to a carriage return).  If a
  1180.           '\n' is placed at the end of the text string, the cursor Y value
  1181.           advances by YCharSize pixels (equivalent to a line feed).  Putting
  1182.          '\r\n' at the end of a text string results in a line feed and carriage
  1183.           return.
  1184.  
  1185. 3.5.6 vsa_get_text_cursor_mode
  1186. Prototype:     unsigned vsa_get_text_cursor_mode(void);
  1187.  
  1188. Description:   This routine returns the mode of the text cursor operation.
  1189.  
  1190. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  1191.  
  1192. 3.5.7 vsa_write_string
  1193. Prototype:     void vsa_write_string(int x,int y,unsigned color,
  1194.                                      char far *string);
  1195.  
  1196. Description:   This routine writes a null terminated text string 'string' at
  1197.           position (x,y).  The text is written with the 'color' passed to this
  1198.           routine. After execution, if the text cursor mode is '0', the text
  1199.           cursor remains at 'x,y', otherwise it is set to the end of the text
  1200.           string just written (see comments in section 3.5.5).
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.                                  Page: 22
  1210.                                
  1211.  
  1212. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1213.  
  1214. Comments:      This routine was redefined in version 3.0 to support the new
  1215.           vector stroked fonts.  The text is drawn with vector strokes at the
  1216.           scale factor determined by the vsa_set_text_scale routine.  Full 2D
  1217.           clipping is performed according to the values set with the
  1218.           vsa_set_clip_mode and vsa_set_viewport routines.
  1219.  
  1220. 3.5.8 vsa_write_string_alt
  1221. Prototype:     void vsa_write_string_alt(char far *string);
  1222.  
  1223. Description:  This routine writes a null terminated text string 'string' at the
  1224.           current text cursor position as determined by vsa_set_text_cursor.
  1225.           The text is written with the current text color.  After execution, if
  1226.           the text cursor mode is '0', the current text cursor remains
  1227.           unchanged, otherwise it is set to the end of the text string just
  1228.           written (see comments in section 3.5.5).
  1229.  
  1230. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1231.  
  1232. Comments:      This routine was redefined in version 3.0 to support the new
  1233.           vector stroked fonts.  The text is drawn with vector strokes at the
  1234.           scale factor determined by the vsa_set_text_scale routine.  Full 2D
  1235.           clipping is performed according to the values set with the
  1236.           vsa_set_clip_mode and vsa_set_viewport routines.
  1237.  
  1238. 3.6 Basic Drawing Functions
  1239. 3.6.1 vsa_move_to
  1240. Prototype:     void vsa_move_to(int x,int y);
  1241.  
  1242. Description:   This routine sets the current cursor position to 'x,y'.  The
  1243.           current cursor position is used by the vsa_line_to, vsa_rect_fill,
  1244.           and vsa_rect functions.
  1245.  
  1246. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1247.  
  1248. 3.6.2 vsa_set_pixel
  1249. Prototype:     void vsa_set_pixel(int x,int y);
  1250.  
  1251. Description:   This routine draws a single pixel at 'x,y' with the current
  1252.                drawing color.
  1253.  
  1254. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.                                  Page: 23
  1265.                                
  1266. 3.6.3 vsa_get_pixel
  1267. Prototype:     unsigned vsa_get_pixel(int x,int y);
  1268.  
  1269. Description:   This routine returns the current pixel value at screen
  1270.                coordinates 'x,y'.
  1271.  
  1272. Availability:  In VSA256 Graphics Library Version 3.0 and up.
  1273.  
  1274. Comments:      Unpredictable things may happen if you try to get a pixel that
  1275.                is outside of the XResolution-1 screen dimensions.
  1276.  
  1277. 3.6.4 vsa_line_to
  1278. Prototype:     void vsa_line_to(int x,int y);
  1279.  
  1280. Description:   This routine draws a line from the current cursor position to
  1281.           'x,y' with the current drawing color.  Then the current cursor
  1282.           position is moved to 'x,y'.
  1283.  
  1284. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1285.  
  1286. 3.6.5 vsa_gouraud_line
  1287. Prototype:     void vsa_gouraud_line(int x0,int c0,int x1,int c1,int y);
  1288.  
  1289. Description:   This routine draws a color interpolated line from the 'x0,y'
  1290.           to 'x1,y1'.  The pixel color value is linearly varied from a starting
  1291.           value of 'c0' at 'x0,y' to an ending value of 'c1' at 'x1,y'.  This
  1292.           technique of color interpolation is named Gouraud shading after the
  1293.           famous Joe-Bob** Not Really! Gouraud ... a French guy.  Valid values
  1294.           for 'c0' and 'c1' are 0 through 255 and serve as indexes into the
  1295.           Color Look Up Table. Gouraud shaded lines serve as a fundamental
  1296.           drawing element for realistic 3-D graphics.  The current cursor
  1297.           position remains unaffected by this routine.
  1298.  
  1299. Availability:  In VSA256 Graphics Library Version 2.0 and up.
  1300.  
  1301. 3.6.6 vsa_rect
  1302. Prototype:     void vsa_rect(int x,int y);
  1303.  
  1304. Description:  This routine draws a rectangle from the current cursor position
  1305.               to the rectangles diagonal position 'x,y' with the current color.
  1306.  
  1307. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.                                  Page: 24
  1320.                                
  1321.  
  1322. 3.6.7 vsa_rect_fill
  1323. Prototype:     void vsa_rect_fill(int x,int y);
  1324.  
  1325. Description:   This routine draws a filled rectangle from the current cursor
  1326.           position to the rectangles diagonal position 'x,y' with the current
  1327.           color.
  1328.  
  1329. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1330.  
  1331. 3.6.8 vsa_triangle
  1332. Prototype:     void vsa_triangle(int x0,int y0,int x1,int y1,int x2,int y2);
  1333.  
  1334. Description:   This routine draws a triangle defined by the 3 vertices 'x0,y0',
  1335.           'x1,y1', and 'x2,y2'.  The triangle is drawn with the current drawing
  1336.           color.  The current cursor position remains unaffected by this
  1337.           routine.
  1338.  
  1339. Availability:  In VSA256 Graphics Library Version 4.0 and up.
  1340.  
  1341. Comments:      If Triangle clip mode is off (see vsa_set_triangle_clip_mode),
  1342.                triangle drawing is significantly faster (see Sec. 5.1).
  1343.  
  1344. 3.6.9 vsa_triangle_fill
  1345. Prototype:    void vsa_triangle_fill(int x0,int y0,int x1,int y1,int x2,int
  1346. y2);
  1347.  
  1348. Description:   This routine draws a filled triangle defined by the 3 vertices
  1349.           'x0,y0', 'x1,y1', and 'x2,y2'.  The triangle is drawn with the
  1350.           current drawing color. The current cursor position remains unaffected
  1351.           by this routine.
  1352.  
  1353. Availability:  In VSA256 Graphics Library Version 2.0 and up.
  1354.  
  1355. Comments:      If Triangle clip mode is off (see vsa_set_triangle_clip_mode),
  1356.                triangle drawing is significantly faster (see Sec. 5.1).
  1357.  
  1358. 3.6.10 vsa_shaded_triangle
  1359. Prototype:     void vsa_shaded_triangle(int x0,int y0,int c0,int x1,int y1,
  1360.                                        int c1,int x2,int y2,int c2);
  1361.  
  1362. Description:   This routine draws a color interpolated triangle defined by the
  1363.           3 vertices 'x0,y0', 'x1,y1', and 'x2,y2'.  The pixel color value is
  1364.           linearly varied in 2 dimensions across the surface of the triangle
  1365.           using the values 'c0', 'c1', and 'c2' as the starting colors at the
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.                                  Page: 25
  1375.                                
  1376.           respective vertices.  This technique of color interpolation is named
  1377.           Gouraud shading after the famous Joe-Bob** Not Really! Gouraud ... a
  1378.           French guy.  Valid values for 'c0', 'c1', and 'c2' are 0 through 255
  1379.           and serve as indexes into the Color Look Up Table.  Gouraud shaded
  1380.           triangles serve as a fundamental drawing element for realistic 3-D
  1381.           graphics.  (Basically, most 3-D surfaces can be constructed out of
  1382.           shaded triangles).  The current cursor position remains unaffected
  1383.           by this routine.
  1384.  
  1385. Availability:  In VSA256 Graphics Library Version 2.0 and up.
  1386.  
  1387. Comments:      If Triangle clip mode is off (see vsa_set_triangle_clip_mode),
  1388.                triangle drawing is significantly faster (see Sec. 5.1).
  1389.  
  1390. 3.6.11 vsa_h_line
  1391. Prototype:     void vsa_h_line(int    y,int x0,int x1);
  1392.  
  1393. Description:   This routine draws a horizontal line from 'x0,y' to 'x1,y'.
  1394.           The line is drawn with the current drawing color.  For horizontal
  1395.           lines this function is quicker than the vsa_line_to function.
  1396.  
  1397. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1398.  
  1399. 3.6.12 vsa_v_line
  1400. Prototype:     void vsa_v_line(int x,int y0,int y1);
  1401.  
  1402. Description:   This routine draws a vertical line from 'x,y0' to 'x,y1'.  The
  1403.           line is drawn with the current drawing color.  For vertical lines
  1404.           this function is quicker than the vsa_line_to function.
  1405.  
  1406. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1407.  
  1408. 3.7 Specialized Drawing Functions
  1409. 3.7.1 vsa_raster_line
  1410. Prototype:     void vsa_raster_line(int x0,int x1,int y,
  1411.                                     unsigned char far *array);
  1412.  
  1413. Description: This routine draws a horizontal raster line from 'x0,y' to 'x1,y'.
  1414.         The 'array[]' values specify each pixel's color value.  If x0 <= x1,
  1415.         then 'array[0]' defines the color of the first pixel in the line at
  1416.         'x0,y'.  If x1 < x0, then 'array[0]' defines the color of the first
  1417.         pixel in the line at 'x1,y'.  The vsa_raster_line routine is
  1418.         typically used to draw images on the display one raster line at a time.
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.                                  Page: 26
  1430.                                
  1431.  
  1432. Availability:  In VSA256 Graphics Library Version 1.0 and up.
  1433.  
  1434. 3.7.2 vsa_get_raster_line
  1435. Prototype:     void vsa_get_raster_line(int x0,int x1,int y,
  1436.                                         unsigned char far *array);
  1437.  
  1438. Description:  This routine gets a horizontal raster line from 'x0,y' to 'x1,y'.
  1439.           The 'array[]' is loaded with each pixel's color value.  If x0 <= x1,
  1440.           then 'array[0]' defines the color of the first pixel in the line at
  1441.           'x0,y'.  If x1 < x0, then 'array[0]' defines the color of the first
  1442.           pixel in the line at 'x1,y'. The vsa_get_raster_line routine is
  1443.           typically used to read back images already drawn on the display one
  1444.           raster line at a time.
  1445.  
  1446. Availability:  In VSA256 Graphics Library Version 2.0 and up.
  1447.  
  1448. Comments:      This routine limits x0 and x1 within the range of 0 and
  1449.          XResolution-1. If x0 goes negative, the first element of 'array' holds
  1450.           the pixel at x=0 and less than x1-x0+1 pixels will be  loaded  into
  1451.           'array'. Likewise, if x1 is greater than XResolution-1, less than x1-
  1452.           x0+1 pixels will be loaded  into 'array'.
  1453.  
  1454. 3.7.3 vsa_image_size
  1455. Prototype:     unsigned long vsa_image_size(int x0,int y0,int x1,int y1);
  1456.  
  1457. Description:   This routine calculates the size of the image defined within a
  1458.           rectangle bound by 'x0,y0' and 'x1,y1'.  The size of the image plus 4
  1459.           is returned.
  1460.              The vsa_image_size routine is typically used to determine the size
  1461.           of the image array to be allocated and used in the vsa_get_image and
  1462.           vsa_put_image routines.
  1463.  
  1464. Availability:  In VSA256 Graphics Library Version 3.0 and up.
  1465.  
  1466. 3.7.4 vsa_get_image
  1467. Prototype:     void vsa_get_image(int x0,int y0,int x1,int y1,
  1468.                                  unsigned char huge *image_array);
  1469.  
  1470. Description:   This routine gets the image defined in the rectangle 'x0,y0' to
  1471.         'x1,y1' and stores it in the memory buffer pointed to by 'image_array'.
  1472.           The memory for 'image_array' must be allocated prior to this call.
  1473.           Upon returning from this routine, the first 2 bytes of the
  1474.           'image_array' buffer contain the image width, and the second 2 bytes
  1475.           contain the image height.  The remaining bytes in the 'image_array'
  1476.           buffer hold the image pixel data.
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.                                  Page: 27
  1485.                                
  1486.                The vsa_get_image routine is typically used in conjunction with
  1487.           the vsa_put_image routine for BitBLT operations.
  1488.  
  1489. Availability:  In VSA256 Graphics Library Version 3.0 and up.
  1490.  
  1491. Comments:      This routine clamps x0, y0, x1, and y1 to zero.  If any of
  1492.          these parameters are less than zero, vsa_get_image overrides them with
  1493.           zero and less than (x1-x0+1)*(y1-y0+1) pixels will be  loaded  into
  1494.           'image_array'. No limiting of y0 and y1 to YResolution-1 is performed
  1495.           so that off screen memory can be used as scratch pad area (see
  1496.           Sec. 5.3).
  1497.  
  1498. 3.7.5 vsa_put_image
  1499. Prototype:    void vsa_put_image(int x0,int y0,unsigned char huge *image_array,
  1500.                                  int raster_op);
  1501.  
  1502. Description:   This routine displays the image defined in the 'image_array'
  1503.           buffer starting at screen coordinates 'x0,y0'.  The image
  1504.           width and height are determined by the first two 16 bit words of
  1505.           the 'image_array' buffer.  The 'raster_op' parameter determines how
  1506.           the data in the 'image_array' buffer are merged with the existing
  1507.           screen data, as defined below.
  1508.  
  1509.           raster_op     Function
  1510.            0            Replace existing data.
  1511.            1            AND with existing data.
  1512.            2            OR with existing data.
  1513.            3            XOR with existing data.
  1514.            4            Reserved .... Do Not Use !!
  1515.            5            Reserved .... Do Not Use !!
  1516.            6            Replace existing data only with non-zero pixels
  1517.                        (Sprites!).
  1518.  
  1519.           The vsa_put_image routine is typically used in conjunction with
  1520.           the vsa_get_image routine for BitBLT operations.
  1521.  
  1522. Availability:  In VSA256 Graphics Library Version 3.0 and up.
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.                                  Page: 28
  1540.                                
  1541.  
  1542. 4.0 NITTY GRITTIES
  1543.  
  1544. 4.1 Registration Information
  1545.           If you find the VSA256 Graphics Library useful, a registration of $34
  1546. would be appreciated.  Registration brings with it MAJOR BENEFITS, as spelled
  1547. out in section 1.2, so look at the ORDER.TXT file and fill it out!
  1548.  
  1549.           Please fill out the Information About You and the Wish List sections,
  1550. and indicate the version number of the software you are presently using.  Send
  1551. check or money order to:
  1552.  
  1553.                                    Spyro Gumas
  1554.                             7910 W. Brookridge Drive
  1555.                               Middletown, MD  21769
  1556.  
  1557.  
  1558.                 ******  COMPUSERVE   -   SWREG  ID: 5417  ******
  1559.  
  1560. If you are on CompuServe, you can register through SWREG. Just "GO SWREG", then
  1561. give  them  the registration ID: 5417. They will bill you $49.00 and I'll  send
  1562. you  both VSA256 and TIFF256 graphics Libraries (plus the goodies!). Please  do
  1563. fill  out and send me the information form so you can tell me what you want  in
  1564. the next revision.
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.                                  Page: 29
  1595.                                
  1596. 4.2 Software License
  1597.                        VSA256 Graphics Library, Version 4.0
  1598.             Copyright Spyro Gumas, 1992 - 1996.  All Rights Reserved.
  1599.  
  1600.    The VSA256 Graphics Library is a "shareware program" and is provided  at  no
  1601. charge to the user for evaluation. The essence of "user-supported" software  is
  1602. to provide  personal computer users with quality software without high  prices,
  1603. and yet  to  provide  incentive for programmers  to  continue  to  develop  new
  1604. products.  If  you  find this program useful and find that you  are  using  The
  1605. VSA256 Graphics Library and continue to use The VSA256 Graphics Library after
  1606. a reasonable trial period, you must make a registration payment of $34 to
  1607. Spyro Gumas. The $34 registration fee will license one copy for use on any one
  1608. computer  at any one time.  You must treat this software just like a book.   An
  1609. example  is  that this software may be used by any number of people and may  be
  1610. freely  moved  from one computer location to another, so long  as  there is  no
  1611. possibility of it being used at one location while it's being used at  another.
  1612. Just as a book cannot be read by two different persons at the same time.
  1613.  
  1614. You are free (and encouraged) to copy and distribute the VSA256 Graphics
  1615. Library if:
  1616.  
  1617. 1)   It is not used as a component of another software library.
  1618. 2)   No fee is charged for use, copying or distribution.
  1619. 3)   It is distributed as is (preferably as VSA256.ZIP) and not modified in
  1620.      any way.
  1621.  
  1622. Furthermore, you are granted royalty free use of The VSA256 Graphics Library
  1623. executable code in any of your programs given that:
  1624.  
  1625. 1)   You have registered your use of The VSA256 Graphics Library and paid the
  1626.      $34 registration fee.
  1627. 2)   It is not used as a component of another software library.
  1628. 3)   You visibly acknowledge the use of The VSA256 Graphics Library in your
  1629.      product in both the printed materials and the executable software with the
  1630.      following statement:
  1631.  
  1632.      "This software uses the VSA256 Graphics Library,
  1633.       Copyright Spyro Gumas, 1992 - 1996.  All Rights Reserved"
  1634.  
  1635.  
  1636.    Clubs and  user  groups may charge a nominal fee (not  to  exceed  $10)  for
  1637. expenses and  handling while distributing the VSA256 Graphics Library.   Anyone
  1638. distributing The VSA256 Graphics Library for any kind of remuneration must
  1639. first contact Spyro Gumas at the address below for authorization. This
  1640. authorization will be automatically granted to distributors recognized by the
  1641. (ASP) as adhering to its guidelines for shareware distributors, and such
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.                                  Page: 30
  1650.                                
  1651. distributors may begin offering The VSA256 Graphics Library immediately
  1652. (However Spyro Gumas must still  be advised so that the distributor can be kept
  1653. up-to-date with the latest version of The VSA256 Graphics Library.).
  1654.  
  1655.    Commercial users of The VSA256 Graphics Library must register  and  pay  for
  1656. their copies of The VSA256 Graphics Library within 30 days of first use or
  1657. their license  is  withdrawn.   Consult the file ORDER.TXT  for  more
  1658. information  or contact Spyro Gumas.
  1659.  
  1660. 4.3 Disclaimer
  1661.   Users of The VSA256 Graphics Library must accept this disclaimer of warranty:
  1662. The VSA256 Graphics Library is supplied as is.  The author disclaims all
  1663. warranties, expressed or implied, including, without limitation, the warranties
  1664. of merchantability and of fitness for any purpose. The author assumes no
  1665. liability for damages, direct or consequential, which may result from the use
  1666. of The VSA256 Graphics Library.  In no event shall the author's liability for
  1667. any damages ever exceed the price paid for the license to use The VSA256
  1668. Graphics Library, regardless of the form of the claim.  The person using The
  1669. VSA256 Graphics Library bears all risk as to the quality and performance of
  1670. this software.
  1671.  
  1672. 4.4 Technical Support
  1673.   If you have any questions or comments about the VSA256 Graphics Library,
  1674. please write me at:
  1675.  
  1676.                                    Spyro Gumas
  1677.                             7910 W. Brookridge Drive
  1678.                               Middletown, MD  21769
  1679.  
  1680. Or, contact me on EMAIL!
  1681.  
  1682.                       CompuServe: 71064,1571
  1683.                       Internet: 71064.1571@compuserve.com
  1684.  
  1685.  
  1686.  
  1687. And Make Sure to visit my WEB PAGE at:
  1688.  
  1689.               http://ourworld.compuserve.com/homepages/blueberry
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.                                  Page: 31
  1705.                                
  1706.  
  1707. 5.0 APPLICATION NOTES
  1708.  
  1709. 5.1 Using Triangles
  1710.   Starting with VSA256 V4.0, the programmer can turn off clipping specifically
  1711. for triangle drawing operations via the vsa_set_triangle_clip_mode routine.
  1712. You may ask "why is this a reasonable thing?".
  1713.   One of the intended uses for the vsa_shaded_triangle routine is to use lots
  1714. of small shaded triangles to form large 3D shaped surfaces.  The process of
  1715. breaking down the large surface into small patches is called "tessellation" (I
  1716. think).  If you actually go to the effort of writing software to do this, maybe
  1717. using Bezier curves or B-splines, you could also clip the large surface
  1718. dimensions to the clipping window prior to the tessellation process.  If you do
  1719. so, and turn off triangle clipping, you will eliminate the overhead of having
  1720. to clip test the hundreds of tiny triangles that are mostly within the window
  1721. anyway.  Turning triangle clipping off doubles the drawing speed of 30 x 30 x
  1722. 42 pixel triangles using vsa_shaded_triangle.
  1723.  
  1724. 5.2 Page Flipping
  1725.   Ever since VSA256 V1.0, the vsa_set_display_start routine has been available
  1726. for page flipping (Ping-Pong Buffering) of the video memory.  But I'll be the
  1727. first to admit that using this feature was not intuitive.  You had to turn off
  1728. all clipping and then draw in off screen Y coordinates to get to the second
  1729. page... what a mess.
  1730.   VSA256 V4.0 cleans up all of this confusion.  With vsa_set_draw_page and
  1731. vsa_set_view_page, the programmer no longer has to think about the details.
  1732. After vsa_init, DRAW_PAGE and VIEW_PAGE both = 0. The programmer can follow the
  1733. following sequence for professional looking results.
  1734.  
  1735. - vsa_set_draw_page(1);                  // flip to video page 1 for drawing.
  1736. - vsa_set_color(0);                      // set to background color.
  1737. - vsa_move_to(0,0);
  1738. - vsa_rect_fill(XResolution-1,YResolution-1);   // Clear page 1.
  1739. - BlahBlahBlah                           // Do all of your drawing.
  1740. - vsa_wait_vsync();                      // optional.
  1741. - vsa_set_view_page(1);                  // Display page 1 on screen.
  1742. - vsa_set_draw_page(0);                  // flip to video page 0 for drawing.
  1743. - repeat clearing and drawing into vid page 0 now.
  1744.  
  1745. 5.3 Using Off Screen Video Memory
  1746.   You may find it convenient to create small bit maps (Sprites?) and store them
  1747. off screen in undisplayed video memory,  for instance all of the cute little
  1748. buttons used in a GUI program. Then you can use vsa_get_image to snatch them up
  1749. and vsa_put_image to plop them down somewhere on the displayable screen. This
  1750. would be of particular interest to a programmer who is fresh out of extra
  1751. memory to allocate for the storage of these bitmaps.
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.                                  Page: 32
  1760.                                
  1761.   To do this, all you need is to set the viewport 'bottom' value far enough
  1762. below the bottom of the displayable video memory to leave room for your
  1763. bitmaps. For example, say you are running in 800x600 video mode and you have 25
  1764. bit mapped buttons of 32x32 size each which you would like to predraw and
  1765. store. Set the clipping viewport to include pixel row 631 with
  1766. vsa_set_viewport(0,0,799,631).  Now go ahead and draw your buttons in the space
  1767. between 0,600 and 799,631.  The display will only show the area between 0,0 and
  1768. 799,599 ... your buttons won't show. But they are there and you can access them
  1769. with vsa_get_image and you can display them with vsa_put_image.  Pretty cool
  1770. huh?
  1771.  
  1772. 5.4 Expanding the VSA_FONT Character Set
  1773.   Starting with VSA256 V4.0 you can change the number of possible characters in
  1774. the font array.  If you want to increase the total number of characters, just
  1775. change the '96' dimension in the 'ASC[96][72]' declaration in the VSA_FONT.H
  1776. file to the new desired number of characters.  Then make sure to fill out the
  1777. remainder of the array.
  1778.   This new capability is a result of strong international pressures.  Now you
  1779. folks can go and customize your own, large, international font sets.  How about
  1780. if you share these new VSA_FONT.H files with me and I can make them available
  1781. to all users via my Web page?
  1782.  
  1783.  
  1784. 6.0 GRAPHICS LIBRARY EXTENSIONS
  1785.  
  1786.   The VSA256 Graphics Library is a base library which is supported by Graphics
  1787. Library Extensions (GLEs) for more specialized tasks.  These GLEs are typically
  1788. shareware and new ones are developed periodically.
  1789.  
  1790. 6.1 THE VSA256 GLE DEVELOPERS PROGRAM
  1791.  
  1792.   I want to encourage people to write VSA256 GLEs.  The reason is simple.  As
  1793. the number of available GLEs grows, so does the applicability of the VSA256
  1794. Graphics Library to various software applications.  As this happens, the demand
  1795. for the VSA256 Graphics Library grows, and the better off I become.  For this
  1796. reason, I started the VSA256 GLE Developers Program (VGDP).
  1797.  
  1798. What Is It?    The VGDP is an incentive arrangement between myself and GLE
  1799. developers by which I get developers to write VSA256 GLEs.
  1800.  
  1801. How's It Work?    A developer writes a VSA256 GLE and sends it to me.  If it
  1802. adds a unique capability and it meets my quality standards, it is added to the
  1803. list of goodies that I offer to registered users. When a user registers for the
  1804. VSA256 Graphics Library, in addition to the normal stuff, I also send him the
  1805. VSA256 GLE.  If he likes your GLE, he can register for it by sending you
  1806. payment.
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.                                  Page: 33
  1815.                                
  1816. What's In It For Me?    Clearly I get a lot of benefits.  1) The overall demand
  1817. for the VSA256 Graphics Library goes up.  2) I get to use your GLE as an
  1818. incentive for people to register for my software.  3) I don't have to write all
  1819. of the VSA256 related GLEs out there.  4) I get to meet a lot of interesting
  1820. people doing really interesting things.
  1821.  
  1822. What's In It For You?    You wouldn't do this unless you also benefit, right?
  1823. 1)  Exposure of your product. The VSA256 Graphics Library has been around since
  1824.     1991 and has developed quite a following.
  1825.     -  The VSA256 Graphics Library has been featured in two books by SAMs
  1826.        Publishing  (Tricks of the Graphics Gurus and PC Graphics Unleashed).
  1827.     -  New GLEs will receive exposure in any subsequent book deals.
  1828.     -  Your GLE gets exposure through the flyers I send out.
  1829.     -  I feature each of the existing VSA256 GLEs on my home page.
  1830. 2)  Ready made market.  The VGDP lets you take advantage of an existing base of
  1831.     people already programming with the VSA256 Graphics Library.  If you have a
  1832.     useful GLE, they will be anxious to get there hands on it.
  1833. 3)  The VGDP is a helping hand in getting your shareware business up and
  1834.     running.  You can start from scratch, but it sure is easier to ride on the
  1835.     coat tails of a successful product.
  1836.  
  1837. A suggestion - A submission to the VGDP should be a self contained, preferably
  1838. zipped package which is ready to go to the user and includes as a minimum:
  1839. -  The Library File
  1840. -  Any Include Files
  1841. -  Demo Program
  1842. -  Documentation File
  1843. -  Order Form (So they can send you registration payments)
  1844.  
  1845. Some possible VSA256 GLEs:
  1846. -  A GUI
  1847. -  A really robust 3D library
  1848. -  Integrating Sound into the VSA256 environment
  1849. -  How about a 3d fly by phase shifting Doppler corrected sound modeler
  1850. -  Fancy 3D stuff
  1851. -  Fancy Text Manipulation Stuff
  1852. -  Various Image readers.
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.                                  Page: 34
  1870.                                
  1871.  
  1872. 6.2 EXISTING GRAPHICS LIBRARY EXTENSIONS
  1873.  
  1874.  
  1875. TIFF256 Graphics Library Extension 4.0 - This library extension provides
  1876. functions which operate with Tagged Image File Format (TIFF) images. With these
  1877. functions, you can traverse the image file, extract image information, and
  1878. display the images as part of your own program.  You can also modify the TIFF
  1879. images and write them back to TIFF files.  Furthermore, any image that you
  1880. generate with VSA256 can be saved as a TIFF file.  The image types supported
  1881. include Bilevel, Grayscale, Palette Color and RGB True Color.  Adaptive Color
  1882. Palette generation is supported for 24 bit images.  This makes most True Color
  1883. images show up undistorted by the 256 color limitation.  Compressed TIFF files
  1884. are also supported for reading and writing.  The full function version of the
  1885. TIFF256 Graphics Library Extensions is shareware, available from the same place
  1886. that you got the VSA256 Graphics Library.
  1887.  
  1888. CBTMouse API Library 1.0 - New from CyberBase Technologies, Inc., this library
  1889. adds complete mouse interaction to your graphics applications.   These guys go
  1890. all out to make mouse driven graphics programming a breeze.  Functions provided
  1891. include initialization, displaying and hiding mouse, reading position, setting
  1892. position, reading button status, working within bounding boxes, changing cursor
  1893. color and size, and waiting for various mouse inputs. You get a very functional
  1894. version of this library when you register for the VSA256 Graphics Library.  The
  1895. full up library (version 1.0) is shipped by CyberBase Technologies, Inc. upon a
  1896. nominal registration fee.
  1897.  
  1898. VSA3D Library 1.0 - This library lets you write 3D applications. What ever your
  1899. interests, Mechanical Design, Architecture, Interior Design, Space Widgets, you
  1900. name it, you can do it.  Functions provided let you add and delete objects from
  1901. a display list, set the view point, and perform 3D transformations including
  1902. scale, offset, and rotation.  Select the drawing mode for the 3D objects from
  1903. Wireframe, Solid, or Gouraud (smooth) Shaded. You get a very functional version
  1904. of this library when you register for the VSA256 Graphics Library.
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.                                  Page: 35
  1925.                                
  1926.  
  1927. 7.0 APPENDIX
  1928.  
  1929. 7.1 VSA.H Include File
  1930. /*.................................. VSA.H ................. 2-24-96 .......*/
  1931. /* This file declares the VSA256 Graphics Library functions and global      */
  1932. /* parameters used throughout the graphics routines.                        */
  1933. /*                                                                          */
  1934. /*                               VERSION 4.0                                */
  1935. /*                                                                          */
  1936. /*         Copyright Spyro Gumas, 1992 - 1996.  All Rights Reserved.        */
  1937. /*..........................................................................*/
  1938.  
  1939. /*..........................................................................*/
  1940. /*                    External Function Prototypes                          */
  1941. /*..........................................................................*/
  1942.  
  1943. extern unsigned  far vsa_set_svga_mode( unsigned );
  1944. extern unsigned  far vsa_get_svga_mode( unsigned far * );
  1945. extern unsigned  far vsa_set_display_start( unsigned, unsigned );
  1946. extern unsigned  far vsa_get_display_start( unsigned far *,unsigned far * );
  1947. extern unsigned  far vsa_init( unsigned );
  1948. extern void      far vsa_set_color( unsigned );
  1949. extern unsigned  far vsa_get_color(void);
  1950. extern void      far vsa_set_text_color( unsigned );
  1951. extern unsigned  far vsa_get_text_color(void);
  1952. extern void      far vsa_set_text_cursor_mode( unsigned );
  1953. extern unsigned  far vsa_get_text_cursor_mode(void);
  1954. extern void      far vsa_set_text_cursor( int, int);
  1955. extern void      far vsa_get_text_cursor( int far *, int far *);
  1956. extern void      far vsa_set_text_scale(float,float);
  1957. extern void      far vsa_get_text_scale(float far *,float far *);
  1958. extern void      far vsa_set_viewport( int, int, int, int);
  1959. extern void      far vsa_get_viewport(int far *,int far *,int far *,int far*);
  1960. extern void      far vsa_set_clip_mode(  unsigned );
  1961. extern unsigned  far vsa_get_clip_mode(void);
  1962. extern void      far vsa_set_triangle_clip_mode(int mode);
  1963. extern int       far vsa_get_triangle_clip_mode(void);
  1964. extern void      far vsa_write_string( int, int, int, char far * );
  1965. extern void      far vsa_write_string_alt( char far * );
  1966. extern void      far vsa_read_color_register( unsigned, unsigned char far *,
  1967.                                    unsigned char far *,unsigned char far *);
  1968. extern void      far vsa_write_color_register( unsigned, unsigned char,
  1969.                                                unsigned char,unsigned char );
  1970. extern void far vsa_read_color_block(unsigned, unsigned,unsigned char far * );
  1971. extern void far vsa_write_color_block(unsigned, unsigned,unsigned char far *);
  1972. extern void far vsa_move_to( int, int);
  1973. extern void far vsa_set_pixel( int, int);
  1974. extern unsigned far vsa_get_pixel( int, int);
  1975. extern void far vsa_line_to( int, int);
  1976. extern void far vsa_triangle( int, int, int, int, int, int);
  1977. extern void far vsa_triangle_fill( int, int, int, int, int, int);
  1978. extern void far vsa_rect_fill( int, int);
  1979.                                  Page: 36
  1980.                                
  1981. extern void far vsa_rect( int, int);
  1982. extern unsigned long far vsa_image_size( int, int, int, int);
  1983. extern void far vsa_get_image( int, int, int, int,unsigned char huge * );
  1984. extern void far vsa_put_image( int, int,unsigned char huge *, unsigned);
  1985. extern void far vsa_h_line( int, int, int);
  1986. extern void far vsa_v_line( int, int, int);
  1987. extern void far vsa_raster_line( int, int, int, unsigned char far *);
  1988. extern void far vsa_get_raster_line( int, int, int,unsigned char far *);
  1989. extern void far vsa_gouraud_line( int, int, int, int, int);
  1990. extern void far vsa_shaded_triangle(int,int,int,int,int,int,int,int,int);
  1991. extern void far vsa_wait_hsync( void );
  1992. extern void far vsa_wait_vsync( void );
  1993. extern void far vsa_about( void );
  1994. extern void vsa_set_draw_page(int);
  1995. extern int  vsa_get_draw_page(void);
  1996. extern void vsa_set_view_page(int);
  1997. extern int  vsa_get_view_page(void);
  1998.  
  1999. /*..........................................................................*/
  2000. /*                    External Parameter Declarations                       */
  2001. /*..........................................................................*/
  2002. extern unsigned far XResolution, far YResolution;
  2003. extern unsigned far XCharResolution, far YCharResolution;
  2004. extern unsigned char far XCharSize, far YCharSize;
  2005. extern unsigned char far BitsPerPixel;
  2006. extern int far XLeft, far XRight, far YTop, far YBottom;
  2007. extern float far Text_X_Scale, far Text_Y_Scale;
  2008. extern int far VSA_ATI_COLOR;
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.                                  Page: 37
  2035.                                
  2036.  
  2037. 7.2 VSA_FONT.H Include File
  2038. /*............................... VSA_FONT.H .............. 2-17-96 ........*/
  2039. /*    This is the font file for the VSA256 Graphics Library.  The basic     */
  2040. /*  font size is set by the XCharBase and YCharBase values defined at the   */
  2041. /*  top of this file.  This include file gives you the ability to fully     */
  2042. /*  customize your fonts! Feel free to edit the font vertex lists to be as  */
  2043. /*  personalized as possible.  Read on to see how it works.                 */
  2044. /*                                                                          */
  2045. /*   ASC[M][N] is a 2 dimensional array.  The M index selects one of 96     */
  2046. /* possible characters and corresponds to the printable ASCII character     */
  2047. /* codes from 32 to 127. (M = 0 selects ASCII character code 32 ... a space,*/
  2048. /* M = 95 selects ASCII character code 127 ... DEL)                         */
  2049. /*   For any given value of M, the N index steps through the vertex list    */
  2050. /* for that character.  Each vertex takes up 3 locations.  The first of     */
  2051. /* the 3 values is the blank code. A blank code of 0 means start a new line */
  2052. /* segment (equivalent to "move_to").  A blank code of 1 means continue     */
  2053. /* drawing (equivalent to "line_to").  A blank code of 255 means END of     */
  2054. /* vertex list. You MUST end each vertex list this way!                     */
  2055. /*   The next two values are x and y coordinates relative to the top left   */
  2056. /* corner of the character cell.  The x and y values should never be more   */
  2057. /* than XCharBase-1 and YCharBase-1 respectively.  When the blank code is   */
  2058. /* 255, the x and y values are ignored.  A maximum of 23 verticies plus an  */
  2059. /* END vertex are allowed per character.  Overrunning this limit will       */
  2060. /* probably cause your PC to go woopie.                                     */
  2061. /*                                                                          */
  2062. /*   Starting with version 4.0 of this library, the user can change the     */
  2063. /* number of possible characters in the font array.  If you want to         */
  2064. /* increase the total number of characters, just change the '96' dimension  */
  2065. /* below in the 'ASC[96][72]' declaration to the new desired number of      */
  2066. /* characters.  Then make sure to fill out the remainder of the array.      */
  2067. /*                                                                          */
  2068. /*                               VERSION 4.0                                */
  2069. /*                                                                          */
  2070. /*        Copyright Spyro Gumas, 1992 - 1996.  All Rights Reserved.         */
  2071. /*..........................................................................*/
  2072.  
  2073. /*..... 12-14-94   Added 'far' to declarations.                        .....*/
  2074. /*.....  2-17-96   Now user can change '96' dimension of ASC array.    .....*/
  2075.  
  2076. unsigned far XCharBase = 8, far YCharBase = 16;
  2077. unsigned char far ASC[96][72]={... Array initialization not printed here  ...
  2078.                                ... for brevity.  See VSA_FONT.H file for  ...
  2079.                                ... details.                               ...
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.                                  Page: 38
  2090.